/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package server.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author fillipe
 */
public class Order implements Serializable {

    private Long id;
    private Date issueDate;
    private Date dataProcessing;
    private BigDecimal totalOrder;
    private Client client;

    public Order() {
        this.issueDate = Calendar.getInstance().getTime();
    }

    public Order(Client client) {
        this();
        this.client = client;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public Date getDataProcessing() {
        return dataProcessing;
    }

    public void setDataProcessing(Date dataProcessing) {
        this.dataProcessing = dataProcessing;
    }

    public Date getIssueDate() {
        return issueDate;
    }

    public void setIssueDate(Date issueDate) {
        this.issueDate = issueDate;
    }

    public BigDecimal getTotalOrder() {
        return totalOrder;
    }

    public void setTotalOrder(BigDecimal totalOrder) {
        this.totalOrder = totalOrder;
    }

    public Client getClient() {
        return client;
    }

    public void setClient(Client client) {
        this.client = client;
    }

    @Override
    public String toString() {
        SimpleDateFormat df = new SimpleDateFormat("ddMMyyyy");
        String issueDt = issueDate != null ? df.format(issueDate) : "";
        String processDt = dataProcessing != null ? df.format(dataProcessing) : "";
        return "Order{" + "id=" + id + ", issueDate=" + issueDt + ", dataProcessing=" + processDt + ", totalOrder=" + totalOrder + ", client=" + client.getId() + '}';
    }
}
